

* Set working directory to the project folder
* Load data_stata_short.dta from the above folder

data_stata_short.dta", clear
xtset InternalSerialNumber ind_sequence

melogit dummynotenjoy lead_nonresponse ///
nonresponse phonemode nooutlminutes median n_invites /// 
days_since_recruit_66to99 days_since_recruit_100to241 days_since_recruit_over241 /// 
abos /// 
RS_Weight weight_stratum2 weight_stratum3 weight_stratum4 weight_stratum5 /// 
age25_34 age35_44 age45_54 age55_64 age65_74 age75plus Male White UKborn /// 
i.RS_Degree housing_tenure i.RS_WorkingStatus_Binary i.RS_CohabitationStatus_Binary /// 
NE_England NW_England Yorkshire_Humberside E_Midlands W_Midlands Eastof_England SE_England SW_England ///
NI Scotland Wales SF_IMDDecile /// 
follows_politics  ///
RS_BFI_2_XS_ExtraversionScore RS_BFI_2_XS_AgreeablenessScore RS_BFI_2_XS_Conscient RS_BFI_2_XS_NegativeEmotion RS_BFI_2_XS_OpenMindednessScore ///
w18_dummy w20_dummy w22_dummy w23_dummy w23w2_dummy ///
w23w3_dummy || InternalSerialNumber:


predict muhat, mu

keep muhat InternalSerialNumber ind_sequence nonresponse dummynotenjoy lead_nonresponse ///
phonemode nooutlminutes median n_invites /// 
days_since_recruit_66to99 days_since_recruit_100to241 days_since_recruit_over241 /// 
abos /// 
RS_Weight weight_stratum2 weight_stratum3 weight_stratum4 weight_stratum5 /// 
age25_34 age35_44 age45_54 age55_64 age65_74 age75plus Male White UKborn /// 
NE_England NW_England Yorkshire_Humberside E_Midlands W_Midlands Eastof_England SE_England SW_England ///
NI Scotland Wales SF_IMDDecile /// 
follows_politics  ///
RS_BFI_2_XS_ExtraversionScore RS_BFI_2_XS_AgreeablenessScore RS_BFI_2_XS_Conscient RS_BFI_2_XS_NegativeEmotion RS_BFI_2_XS_OpenMindednessScore ///
w18_dummy w20_dummy w22_dummy w23_dummy w23w2_dummy w23w3_dummy

export delimited using "predicted_probabilities.csv", replace

log close
